package com.sc.nft.admin.controller;

import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dto.BindTheMenuToThePermissionPackageDTO;
import com.sc.nft.dto.IdRequest;
import com.sc.nft.feign.MerchantExtraPermissionMenuClient;
import com.sc.nft.sup.Result;
import com.sc.nft.vo.PermissionPackageMenuVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 产品额外权限包绑定菜单列表(MerchantExtraPermissionMenu)表控制层
 *
 * @author wwc
 * @since 2023-03-28 11:05:27
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("admin/merchantExtraPermissionMenu")
@Api(tags = "产品额外权限包绑定菜单列表操作")
public class MerchantExtraPermissionMenuController {

    /**
     * 服务对象
     */
    private final MerchantExtraPermissionMenuClient merchantExtraPermissionMenuClient;

    @PostMapping(value = "bindTheMenuToThePermissionPackage", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "给权限包绑定菜单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result bindTheMenuToThePermissionPackage(@RequestBody BindTheMenuToThePermissionPackageDTO bindTheMenuToThePermissionPackageDTO) {
        merchantExtraPermissionMenuClient.bindTheMenuToThePermissionPackage(bindTheMenuToThePermissionPackageDTO);
        return Result.success();
    }

    @PostMapping(value = "getsThePermissionPackageMenuList", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "根据权限包id获取权限包菜单列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<List<PermissionPackageMenuVO>> getsThePermissionPackageMenuList(@RequestBody IdRequest idRequest) {
        return merchantExtraPermissionMenuClient.getsThePermissionPackageMenuList(idRequest);
    }

}
